package com.itheima.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118614509";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCY7fJ10yxgtK34CkIs/RdnWacPta1TVpK5OiPqaSejuY4UU7N3at9S96LfszkU83KoS5ZajJrE1gEHy+if/rPwsT2bd6WULF4vSIXvhm31HjaMYTukXxQeYYp9nBekem9CWEn0kt7EaHsl1phij37F0klO0Jgo4vvAkoHWbqoucjg2A7omRJkfC0EvWyQv1vP/nS79LXTcpXcBFlw8hbg3ynivG2zIzS9U7EYAJuhMlyGcyWdC1m6FvRQfIbq4TMa1Ah6wPqQn0vEtmeS2GqYAtdIjpvNGIp+1CvRKCSNwYUyAUsEbo3TlbmSwxczDmUZExgtJGtEhed95DJkyg0FpAgMBAAECggEAQumh88HRIgMMN4ItkEew7MyCV1JToyo3CoqQ2mjmKjHvI5+336FIU6H8hsqBSFR4r4BbKgVpVoSYcNPcVdz42HCElziTnzCGiUO/Lp1wERcGIQgOM45SXDSrhug8RAA6HBpLSZLVm7RnZZfulvlYK7Al2TFV0lX2dzzjSHKlTaqJEWWeGVnUmki/R5tAB5q69PQZ3mZQXq4h2Ps7XOQbb24JGelKGQ9iaTNZFcGM0OHQ1i+e246o2DgmM5LCpoP3qpPK7jzixYimVg+B9768eHub0l4DGug219hKwL4j0yau7HUjeaHxQA8B2qu9UljS9T16q+QfLSDpZZPJLa/IsQKBgQDKlMZ82aAtFo4i9Rl+yo6fX7U1XtMZljD0UKpF3WxOIuz8iZbesIDz3/NSwlqYskp2dWV7E9J3N/bsT9/SLEjtTi4NIKynqtkYBxiKBkGff2WrD/7P9vVggtOaxpkk2HSpSV4whKzmv+dRAb+pcriNE7uYwj6uNOCFuwmNenTrzQKBgQDBQXCGOHmx2u2J7Wui0RzZE/ApzjQV+FMrhMiA0tL0XaXjR3LA1iPCUk8ASKO2PWttQi/fw4Ngr8yv0NH0LVvUWAEheoCvNzrA2hqdX8T9Z+nLaHP16bhgnJ1ValMyo5ROjXj2VwviaiAUWyuZL879in3ox2rhO4AtyYAI7ehoDQKBgQDHZ0w9RoXY+9Oq6zFOUZmznKSkxRLro5/KTMBeBsb93nkBV3mO95Pm+bDr7Gz60rxi/8mFLYzEVu0RzMmWeorKM2M2/suUOqJ4eTuZWPEtS1xK1nLOR9teRUh+mC/USdADdjllbqM2evz5CsyawVaRXzQP+Ft0ZI4AdIvBnCEMnQKBgQCDHNGpzkEKIH0OGazv7q2CvVswEb0Wtr4+hTy+4cnLjomQdBXvrJjgKpV8nMutRWhP3Rq71lqYy0y0b5kx72Ag5YAG5aTOu0q6Mn7iDGqKfeiJXxllWqcDrN21aIh/j6l7zdGmV5Ixj0yqYtxmdqAZNc+MkVb67jJdXhrmc/o8NQKBgGsa4sIIstdjNKWpYWjZs+HL5sTMHYnKUpwbjCiepvOy3m5zLoS3QEIORvcTyiReiiYt+M+bAOZSxGe0Qttk+ghMsOP/mbFbMY28Wesliy9mB1PvGnSylEil31z+uRGfOhQ5avuKfgu/Ad+5e1E9GkYTQwbHQ4CDzik6dG7iLs7B";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhRjuzpiO3S4XSLIKUyDETOcbbTAPBbxXwc7RvLU4Vptq61G42q/Jh1aYYZIAGphI3nZoG8xmfLdBdTciWatnsYILu4zzJv4G6eKU00C0PaF+nCPamRSuLxe0j09WONaKnHPfEx5UFRWlu3Kp7h7IDf2Y1YP+Rj2ZskXskIEKIrG6J4Ilx5WeAu9alE5P1jrw0ah1S0NCL77qmF58a1wk9X2TMXOTkAKC/H5fP5FQK49rsxvOdcoH/VEBLGkBzdUhZehQiRrLwUKwahfX/ytwBZSQQmI6V5/uBPBiWu1lUIeGMFL+SEHMsbkgeQkypl5Z2ynR0gxF5v8c+06mzaTIrwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://x3npaec.nat.ipyingshe.com/notify/save.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://x3npaec.nat.ipyingshe.com/pages/orderSuccess.html?orderId="+"17&";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

